package com.kaiupup.study.controller;

import com.kaiupup.study.dto.ResponseResult;
import com.kaiupup.study.request.VerificationCodeDTO;
import com.kaiupup.study.service.VerificationcodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @projectName: kaiupup-online-taxi
 * @package: com.kaiupup.study.controller
 * @className: TestController
 * @author: kaiupup
 * @description: TODO
 * @date: 2024/2/26 12:45
 * @version: 1.0
 */

@RestController
@RequestMapping("/test")
public class TestController {


    @GetMapping("/testInterceptor")
    public ResponseResult test(){
        System.out.println("test");
        System.out.println("成功啦");
        return ResponseResult.success("成功啦");
    }

    @Autowired
    private VerificationcodeService verificationcodeService;

    /*
     * 生成验证码
     * */
    @PostMapping("/verificationCode")
    public ResponseResult verificationCode(@RequestBody VerificationCodeDTO verificationCodeDTO){
        System.out.println("verificationCodeDTO = " + verificationCodeDTO);
        return verificationcodeService.generatorCode(verificationCodeDTO.getPassengerPhone());
    }

}
